package com.itheima.work1123;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class Demo02 {
    //使用字节流去复制文件从一个文件夹到另一个文件夹
    public static void main(String[] args) throws Exception{
        //创建字节流对象
        FileInputStream picther1 = new FileInputStream("D:/img1/img1.jpg");
        FileOutputStream picther2 = new FileOutputStream("D:/img2/img2.jpg");
        //数据操作
        int len = 0;
        byte[] buf = new byte[1024];
        while((len=picther1.read(buf))!=-1){
            picther2.write(buf,0,len);
        }
        //释放资源
        picther2.close();
        picther1.close();
    }
}
